<?php 
	require_once 'util/public.php';
	session_start();
	$islogin = FALSE;
	if(isset($_SESSION['login_user'])){
		$islogin = TRUE;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>公司介绍</title>
<link rel="stylesheet" href="./style/default.css" type="text/css" />
<link rel="stylesheet" href="./style/post.css" type="text/css" />
</head>

<body>
  <?php
	// 数据库操作
	require_once 'util/dbconnection.php';
	require_once 'util/public.php';
	
  	$request_id = $_GET['id'];
  	if( !isset($request_id) ){
  		$request_id = 1;
  	}
	
  	connect_db();
  	// 请求文章列表
  	$artArray = get_titles_by_category("about");
  	$par_post = get_post_by_id($request_id);
  	
	close_db();
?>
  <div id="page_header">
  </div>
  <div id="nav_line">
    <ul id="nav_list">
          <li>
              <a href="index.php">网站首页</a>
          </li>
          <li class="active">
              <a href="intro.php">公司介绍</a>
          </li>
          <li>
              <a href="pic_show.php">图片展示</a>
          </li>
          <li>
              <a href="knowledge.php">花卉知识</a>
          </li>
          <li>
              <a href="contact.php">业务联系</a>
          </li>
          <li>
          	<a href="feedback.php">客户留言</a>
          </li>
    </ul>
  </div>
  <div class="body_content"> 
  <div class="intro_content">
	  <div class="left">
	  <h1>介绍列表</h1>
	  <?php 
	  	  echo "（共".count($artArray)."篇介绍）<br>";
	  	  echo "<ul>";
		  foreach( $artArray as $key => $value ){
		  	echo '<li class="art_list"><a href="intro.php?id='.$key.'">'.$value['title'].'</a></li>';
		  }
		  echo "</ul>";
	  ?>
	  </div>
	  <div class="right">
	  	<?php 
	  		$tmp = $artArray[$request_id];
	  		echo "<h1>".$tmp['title']."</h1>";
	  		echo '<p class="p_little">本文由'.$par_post['nick_name'].'发表于'.$par_post['post_date'].'';
	  		if( $islogin ){
	  			echo '&nbsp;<a href="admin/post-add-edit.php?action=edit&id='.$par_post['id'].'">编辑</a>';
	  		}
	  		echo "</p>";
	  		echo '<div class="post_content">';
 			echo $par_post['content'];
	  		echo "</div>";
	  		echo '<p class="p_little">文章访问次数:'.$par_post['visit_times']."次</p>";
	  	?>
	  </div>
  </div>
  </div>
  
   <?php 
   echo_footer($islogin)
  ?>
	
</body>
</html>
